/*
 * Copyright (c) 2011 Team A CS2340. All rights reserved.
 */
package edu.gatech.teama.doctorsoffice.net;

import edu.gatech.teama.doctorsoffice.model.User;
import edu.gatech.teama.doctorsoffice.server.DataModel;


/**
 * Describe the read user message by extending message class
 * 
 * @author Dylan
 * @version 1.0
 */
public class ReadUserMessage extends Message {
	/**
	 * initialize instance payload
	 * @param username the object write in message
	 */
	public ReadUserMessage(String username) {
		super(username);
		// TODO Auto-generated constructor stub
	}

	/**
	 * send message read user
	 * @param model data to manipulate in this case User
	 * @return message created
	 */
	public Message handle(final DataModel model) {
		// TODO Auto-generated method stub
		final User temp = model.readUser((String) this.getPayload());
		return new UserMessage(temp);
	}

	public String toString() { // $codepro.audit.disable methodJavadoc
		return this.getPayload().toString();
	}
	
}
